import Vue from "vue";
import App from "./App";
import store from "./store/index.js";

import uView from "uview-ui";
Vue.use(uView);

import { fetch } from "./utils/request.js";
import {
  getParams,
  getToday,
  getToken,
  getUserId,
  getNowDate,
} from "./utils/utils.js";

import treeSelectOne from "@/uni_modules/ljs-treeChoose/components/ljs-treeChoose/treeSelectOne.vue";
import BaTreePicker from "@/uni_modules/ba-tree-picker/components/ba-tree-picker/ba-tree-picker.vue";
Vue.component("treeSelectOne", treeSelectOne);
Vue.component("BaTreePicker", BaTreePicker);

Vue.prototype.baseUrl = function () {
  return uni.getStorageSync("baseUrl");
};
Vue.prototype.fetch = fetch;
// Vue.prototype.postUpload = postUpload;
Vue.prototype.getParams = getParams;
Vue.prototype.getToday = getToday;
Vue.prototype.getToken = getToken;
Vue.prototype.getUserId = getUserId;
Vue.prototype.getNowDate = getNowDate;
Vue.prototype.$statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
Vue.prototype.$windowHeight = uni.getSystemInfoSync().windowHeight;
Vue.config.productionTip = false;

App.mpType = "app";

//检测用户是否登录
// Vue.prototype.checkLogin = function(userInfo){
// 	if(!getUserId()) {
// 		uni.showToast({
// 			title:"请先登录",
// 			icon:'none'
// 		})
// 		setTimeout(()=>{
// 			uni.navigateTo({
// 				url: '/pages/login/index'
// 			})
// 		},1000)
// 	}
// }

const app = new Vue({
  store,
  ...App,
});
app.$mount();
